package com.concurrent.water.machine;

import java.math.BigDecimal;

/**
 * 控制台输出的显示器
 */
public class DefaultDisplayer implements Displayer {
    private final String name;

    public DefaultDisplayer(String name) {
        this.name = name;
    }

    @Override
    public void tipStart() {
        System.out.println(prefix() + "开始取水");
    }

    @Override
    public void tipStop() {
        System.out.println(prefix() + "结束取水");
    }

    @Override
    public void showMoney(BigDecimal money) {
        System.out.println(prefix() + "余额：" + money);
    }

    @Override
    public void showSeconds(Long seconds) {
        System.out.println(prefix() + "已经接水时长：" + seconds);
    }

    private String prefix() {
        return this.name + " : ";
    }
}
